



function phoneVer(tel){
    if(!(/^1\d{10}$/.test(tel))){
        return false;
    }
    return true;
}


sitewindow();
function sitewindow(){
	var $sitwindow = $('.site-window'),
		$win_content = $('.site-window .win-content'),
		$btn = $('.site-window .btn'),
		$close = $('.site-window .closebtn');
	
	//关闭弹窗
	$btn.on('click',function(){
		$sitwindow.fadeOut();
	});
	$close.on('click',function(){
		$sitwindow.fadeOut();
	});
	
	$win_content.on('click',function(e){
		e.stopPropagation();
	});
	$sitwindow.on('click',function(){
		$sitwindow.fadeOut();
	});
}




//3.案例弹出问题
function siteCase(sel,selector){
	var $sel = $(sel),
		$selector = $(selector);
	
	$sel.on('click',function(){
		$selector.fadeIn();
	});
}
siteCase('#case-first','.win-casefirst');
siteCase('#case-second','.win-casesecond');
siteCase('#case-third','.win-casethird');





//4.点击底部发布需求按钮
scrollfun();
$(window).scroll(function(){
	scrollfun();
});
$('.pdemandbtn').on('click',function(){
	var $section_pdemand = $('#section-pdemand');
	var height = $section_pdemand.offset().top - 50;
	
	$('body,html').animate({
		scrollTop:height
	},800);
});
function scrollfun(){
	var $section_flow = $('#section-flow');
	var scrolltop = $section_flow.offset().top - $(window).scrollTop() - 80;
	if(scrolltop<0){
		$('.pdemand-wrapper').css('display','block');
	}else{
		$('.pdemand-wrapper').css('display','none');
	}
}
	
	
	

//5.视频播放
var $playbtn = $('.playbtn'),
	$video = $('#videov2');
$playbtn.click(function(e) {
	$(this).css('display', 'none');
	$video.trigger('play');
	$video.attr('controls', 'controls');
});





//6.微信分享
var title = '掌握这个秘籍就能打造爆款产品';
//微信分享
wx.ready(function(){
	wxshare();
});
wx.error(function(res){
   console.log(res); 
});


function wxshare(){
	wx.onMenuShareTimeline({
	    title: title,   // 分享标题
	    link: 'http://www.laisj.com/intention',     // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
	    imgUrl: 'http://static.laisj.com/www/publics/intention/img/share.png', // 分享图标
	    success: function () { 
	        // 用户确认分享后执行的回调函数
	        console.log('successShareTimeline');
	        _hmt.push(['_trackEvent', 'share', 'ShareTimeline',0]);
	    },
	    cancel: function () { 
	        // 用户取消分享后执行的回调函数
	        _hmt.push(['_trackEvent', 'share', 'ShareTimeline',2]);
	    }
	});
	//分享给朋友
	wx.onMenuShareAppMessage({
	    title: title, // 分享标题
	    desc: '还有价值5万元增值服务方案等你来领 ', // 分享描述
	    link: 'http://www.laisj.com/intention', // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
	    imgUrl: 'http://static.laisj.com/www/publics/intention/img/share.png', // 分享图标
	    type: 'link', // 分享类型,music、video或link，不填默认为link
	    dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
	    success: function () { 
	        // 用户确认分享后执行的回调函数
	        console.log('successShareAppMessage');
	        _hmt.push(['_trackEvent', 'share', 'ShareAppMessage',0]);
	    },
	    cancel: function () { 
	        // 用户取消分享后执行的回调函数
	        _hmt.push(['_trackEvent', 'share', 'ShareAppMessage',2]);
	    }
	});
}

